<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class Ripper - ripper: Ruby Standard Library Documentation</title>


<script src="./js/navigation.js" defer></script>
<script src="./js/search.js" defer></script>
<script src="./js/search_index.js" defer></script>
<script src="./js/searcher.js" defer></script>
<script src="./js/darkfish.js" defer></script>

<script src="./js/jquery-3.2.0.min.js"></script>

<script src="./js/vue.min.js"></script>
<script src="./js/js.cookie.min.js"></script>

<link href="./css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="./css/rdoc.css" rel="stylesheet">
<link href="./css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "./";
  var index_rel_prefix = "./";
  var darkModeCsseHref = "./css/rdoc-dm.css"
  var defaultModeCssHref = "./css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="./index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="./table_of_contents.html#pages">Pages</a>
    <a href="./table_of_contents.html#classes">Classes</a>
    <a href="./table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    
<div class="nav-section">
  <h3>Table of Contents</h3>

  <ul class="link-list" role="directory">
    <li><a href="#class-Ripper-label-Usage">Usage</a>
    <li><a href="#class-Ripper-label-Resources">Resources</a>
    <li><a href="#class-Ripper-label-Requirements">Requirements</a>
    <li><a href="#class-Ripper-label-License">License</a>
  </ul>
</div>


    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link"><a href="Object.html">Object</a>
</div>

        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-dedent_string">::dedent_string</a>
    <li ><a href="#method-c-lex">::lex</a>
    <li ><a href="#method-c-lex_state_name">::lex_state_name</a>
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-c-parse">::parse</a>
    <li ><a href="#method-c-sexp">::sexp</a>
    <li ><a href="#method-c-sexp_raw">::sexp_raw</a>
    <li ><a href="#method-c-slice">::slice</a>
    <li ><a href="#method-c-tokenize">::tokenize</a>
    <li ><a href="#method-i-column">#column</a>
    <li ><a href="#method-i-compile_error">#compile_error</a>
    <li ><a href="#method-i-debug_output">#debug_output</a>
    <li ><a href="#method-i-debug_output-3D">#debug_output=</a>
    <li ><a href="#method-i-dedent_string">#dedent_string</a>
    <li ><a href="#method-i-encoding">#encoding</a>
    <li ><a href="#method-i-end_seen-3F">#end_seen?</a>
    <li ><a href="#method-i-error-3F">#error?</a>
    <li ><a href="#method-i-filename">#filename</a>
    <li ><a href="#method-i-lineno">#lineno</a>
    <li ><a href="#method-i-parse">#parse</a>
    <li ><a href="#method-i-state">#state</a>
    <li ><a href="#method-i-token">#token</a>
    <li ><a href="#method-i-warn">#warn</a>
    <li ><a href="#method-i-warning">#warning</a>
    <li ><a href="#method-i-yydebug">#yydebug</a>
    <li ><a href="#method-i-yydebug-3D">#yydebug=</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-Ripper">
    <h1 id="class-Ripper" class="class">
      class Ripper
    </h1>

    <section class="description">
    
<p><a href="Ripper.html"><code>Ripper</code></a> is a Ruby script parser.</p>

<p>You can get information from the parser with event-based style. Information such as abstract syntax trees or simple lexical analysis of the Ruby program.</p>

<h2 id="class-Ripper-label-Usage">Usage<span><a href="#class-Ripper-label-Usage">&para;</a> <a href="#top">&uarr;</a></span></h2>

<p><a href="Ripper.html"><code>Ripper</code></a> provides an easy interface for parsing your program into a symbolic expression tree (or S-expression).</p>

<p>Understanding the output of the parser may come as a challenge, it’s recommended you use PP to format the output for legibility.</p>

<pre>require &#39;ripper&#39;
require &#39;pp&#39;

pp Ripper.sexp(&#39;def hello(world) &quot;Hello, #{world}!&quot;; end&#39;)
  #=&gt; [:program,
       [[:def,
         [:@ident, &quot;hello&quot;, [1, 4]],
         [:paren,
          [:params, [[:@ident, &quot;world&quot;, [1, 10]]], nil, nil, nil, nil, nil, nil]],
         [:bodystmt,
          [[:string_literal,
            [:string_content,
             [:@tstring_content, &quot;Hello, &quot;, [1, 18]],
             [:string_embexpr, [[:var_ref, [:@ident, &quot;world&quot;, [1, 27]]]]],
             [:@tstring_content, &quot;!&quot;, [1, 33]]]]],
          nil,
          nil,
          nil]]]]</pre>

<p>You can see in the example above, the expression starts with <code>:program</code>.</p>

<p>From here, a method definition at <code>:def</code>, followed by the method’s identifier <code>:@ident</code>. After the method’s identifier comes the parentheses <code>:paren</code> and the method parameters under <code>:params</code>.</p>

<p>Next is the method body, starting at <code>:bodystmt</code> (<code>stmt</code> meaning statement), which contains the full definition of the method.</p>

<p>In our case, we’re simply returning a String, so next we have the <code>:string_literal</code> expression.</p>

<p>Within our <code>:string_literal</code> you’ll notice two <code>@tstring_content</code>, this is the literal part for <code>Hello, </code> and <code>!</code>. Between the two <code>@tstring_content</code> statements is a <code>:string_embexpr</code>, where <em>embexpr</em> is an embedded expression. Our expression consists of a local variable, or <code>var_ref</code>, with the identifier (<code>@ident</code>) of <code>world</code>.</p>

<h2 id="class-Ripper-label-Resources">Resources<span><a href="#class-Ripper-label-Resources">&para;</a> <a href="#top">&uarr;</a></span></h2>
<ul><li>
<p><a href="http://www.rubyinside.com/using-ripper-to-see-how-ruby-is-parsing-your-code-5270.html">Ruby Inside</a></p>
</li></ul>

<h2 id="class-Ripper-label-Requirements">Requirements<span><a href="#class-Ripper-label-Requirements">&para;</a> <a href="#top">&uarr;</a></span></h2>
<ul><li>
<p>ruby 1.9 (support CVS HEAD only)</p>
</li><li>
<p>bison 1.28 or later (Other yaccs do not work)</p>
</li></ul>

<h2 id="class-Ripper-label-License">License<span><a href="#class-Ripper-label-License">&para;</a> <a href="#top">&uarr;</a></span></h2>

<p>Ruby License.</p>
<ul><li>
<p>Minero Aoki</p>
</li><li>
<p>aamine@loveruby.net</p>
</li><li>
<p><a href="http://i.loveruby.net">i.loveruby.net</a></p>
</li></ul>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">


      <section class="constants-list">
      <header>
      <h3>Constants</h3>
      </header>
      <dl>
          <dt id="EVENTS">EVENTS
          <dd><p>This array contains name of all ripper events.</p>
          <dt id="EXPR_ARG">EXPR_ARG
          <dd><p>newline significant, +/- is an operator.</p>
          <dt id="EXPR_ARG_ANY">EXPR_ARG_ANY
          <dd><p>equals to <code>(EXPR_ARG | EXPR_CMDARG)</code></p>
          <dt id="EXPR_BEG">EXPR_BEG
          <dd><p>ignore newline, +/- is a sign.</p>
          <dt id="EXPR_BEG_ANY">EXPR_BEG_ANY
          <dd><p>equals to <code>(EXPR_BEG | EXPR_MID | EXPR_CLASS)</code></p>
          <dt id="EXPR_CLASS">EXPR_CLASS
          <dd><p>immediate after ‘class’, no here document.</p>
          <dt id="EXPR_CMDARG">EXPR_CMDARG
          <dd><p>newline significant, +/- is an operator.</p>
          <dt id="EXPR_DOT">EXPR_DOT
          <dd><p>‘, no reserved words.</p>
          <dt id="EXPR_END">EXPR_END
          <dd><p>newline significant, +/- is an operator.</p>
          <dt id="EXPR_ENDARG">EXPR_ENDARG
          <dd><p>ditto, and unbound braces.</p>
          <dt id="EXPR_ENDFN">EXPR_ENDFN
          <dd><p>ditto, and unbound braces.</p>
          <dt id="EXPR_END_ANY">EXPR_END_ANY
          <dd><p>equals to <code>(EXPR_END | EXPR_ENDARG | EXPR_ENDFN)</code></p>
          <dt id="EXPR_FITEM">EXPR_FITEM
          <dd><p>symbol literal as FNAME.</p>
          <dt id="EXPR_FNAME">EXPR_FNAME
          <dd><p>ignore newline, no reserved words.</p>
          <dt id="EXPR_LABEL">EXPR_LABEL
          <dd><p>flag bit, label is allowed.</p>
          <dt id="EXPR_LABELED">EXPR_LABELED
          <dd><p>flag bit, just after a label.</p>
          <dt id="EXPR_MID">EXPR_MID
          <dd><p>newline significant, +/- is an operator.</p>
          <dt id="EXPR_NONE">EXPR_NONE
          <dd><p>equals to <code>0</code></p>
          <dt id="EXPR_VALUE">EXPR_VALUE
          <dd><p>equals to <code>EXPR_BEG</code></p>
          <dt id="PARSER_EVENTS">PARSER_EVENTS
          <dd><p>This array contains name of parser events.</p>
          <dt id="SCANNER_EVENTS">SCANNER_EVENTS
          <dd><p>This array contains name of scanner events.</p>
          <dt id="Version">Version
          <dd><p>version of <a href="Ripper.html"><code>Ripper</code></a></p>
        </dl>
        </section>



                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-dedent_string" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">dedent_string</span><span
                                class="method-args">(p1, p2)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="dedent_string-source">
            <pre>static VALUE
parser_dedent_string(VALUE self, VALUE input, VALUE width)
{
    struct parser_params *p;
    rb_parser_config_t *config;
    struct dedent_string_arg args;

    config = rb_ruby_parser_config_new(ruby_xmalloc);
    rb_parser_config_initialize(config);
    p = rb_ruby_parser_new(config);

    args.p = p;
    args.input = input;
    args.width = width;
    return rb_ensure(parser_dedent_string0, (VALUE)&amp;args, parser_config_free, (VALUE)config);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-lex" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">lex</span><span
                                class="method-args">(src, filename = &#39;-&#39;, lineno = 1, **kw)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Tokenizes the Ruby program and returns an array of an array, which is formatted like <code>[[lineno, column], type, token, state]</code>. The <code>filename</code> argument is mostly ignored. By default, this method does not handle syntax errors in <code>src</code>, use the <code>raise_errors</code> keyword to raise a SyntaxError for an error in <code>src</code>.</p>

<pre>require &#39;ripper&#39;
require &#39;pp&#39;

pp Ripper.lex(&quot;def m(a) nil end&quot;)
#=&gt; [[[1,  0], :on_kw,     &quot;def&quot;, FNAME    ],
     [[1,  3], :on_sp,     &quot; &quot;,   FNAME    ],
     [[1,  4], :on_ident,  &quot;m&quot;,   ENDFN    ],
     [[1,  5], :on_lparen, &quot;(&quot;,   BEG|LABEL],
     [[1,  6], :on_ident,  &quot;a&quot;,   ARG      ],
     [[1,  7], :on_rparen, &quot;)&quot;,   ENDFN    ],
     [[1,  8], :on_sp,     &quot; &quot;,   BEG      ],
     [[1,  9], :on_kw,     &quot;nil&quot;, END      ],
     [[1, 12], :on_sp,     &quot; &quot;,   END      ],
     [[1, 13], :on_kw,     &quot;end&quot;, END      ]]</pre>

                              <div class="method-source-code" id="lex-source">
            <pre><span class="ruby-comment"># File ripper/lib/ripper/lexer.rb, line 51</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Ripper</span>.<span class="ruby-identifier ruby-title">lex</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">filename</span> = <span class="ruby-string">&#39;-&#39;</span>, <span class="ruby-identifier">lineno</span> = <span class="ruby-value">1</span>, <span class="ruby-operator">**</span><span class="ruby-identifier">kw</span>)
  <span class="ruby-constant">Lexer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">filename</span>, <span class="ruby-identifier">lineno</span>).<span class="ruby-identifier">lex</span>(<span class="ruby-operator">**</span><span class="ruby-identifier">kw</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-lex_state_name" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">lex_state_name</span><span
                                class="method-args">(p1)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="lex_state_name-source">
            <pre>static VALUE
ripper_lex_state_name(VALUE self, VALUE state)
{
    struct parser_params *p;
    rb_parser_config_t *config;
    struct lex_state_name_arg args;

    config = rb_ruby_parser_config_new(ruby_xmalloc);
    rb_parser_config_initialize(config);
    p = rb_ruby_parser_new(config);

    args.p = p;
    args.state = state;

    return rb_ensure(lex_state_name0, (VALUE)&amp;args, parser_config_free, (VALUE)config);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-new" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          new(src, filename=&quot;(ripper)&quot;, lineno=1) &rarr; ripper
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Create a new <a href="Ripper.html"><code>Ripper</code></a> object. <em>src</em> must be a String, an IO, or an <a href="Object.html"><code>Object</code></a> which has gets method.</p>

<p>This method does not starts parsing. See also <a href="Ripper.html#method-i-parse"><code>Ripper#parse</code></a> and <a href="Ripper.html#method-c-parse"><code>Ripper.parse</code></a>.</p>

                              <div class="method-source-code" id="new-source">
            <pre>static VALUE
ripper_initialize(int argc, VALUE *argv, VALUE self)
{
    struct ripper *r;
    struct parser_params *p;
    VALUE src, fname, lineno;
    VALUE (*gets)(struct parser_params*,VALUE);
    VALUE input, sourcefile_string;
    const char *sourcefile;
    int sourceline;

    TypedData_Get_Struct(self, struct ripper, &amp;parser_data_type, r);
    p = r-&gt;p;
    rb_scan_args(argc, argv, &quot;12&quot;, &amp;src, &amp;fname, &amp;lineno);
    if (RB_TYPE_P(src, T_FILE)) {
        gets = ripper_lex_io_get;
    }
    else if (rb_respond_to(src, id_gets)) {
        gets = ripper_lex_get_generic;
    }
    else {
        StringValue(src);
        gets = rb_ruby_ripper_lex_get_str;
    }
    input = src;
    if (NIL_P(fname)) {
        fname = STR_NEW2(&quot;(ripper)&quot;);
        OBJ_FREEZE(fname);
    }
    else {
        StringValueCStr(fname);
        fname = rb_str_new_frozen(fname);
    }
    rb_ruby_ripper_parser_initialize(p);

    sourcefile_string = fname;
    sourcefile = RSTRING_PTR(fname);
    sourceline = NIL_P(lineno) ? 0 : NUM2INT(lineno) - 1;

    rb_ruby_parser_ripper_initialize(p, gets, input, sourcefile_string, sourcefile, sourceline);

    return Qnil;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-parse" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">parse</span><span
                                class="method-args">(src, filename = &#39;(ripper)&#39;, lineno = 1)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Parses the given Ruby program read from <code>src</code>. <code>src</code> must be a String or an IO or a object with a gets method.</p>

                              <div class="method-source-code" id="parse-source">
            <pre><span class="ruby-comment"># File ripper/lib/ripper/core.rb, line 18</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Ripper</span>.<span class="ruby-identifier ruby-title">parse</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">filename</span> = <span class="ruby-string">&#39;(ripper)&#39;</span>, <span class="ruby-identifier">lineno</span> = <span class="ruby-value">1</span>)
  <span class="ruby-identifier">new</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">filename</span>, <span class="ruby-identifier">lineno</span>).<span class="ruby-identifier">parse</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-sexp" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">sexp</span><span
                                class="method-args">(src, filename = &#39;-&#39;, lineno = 1, raise_errors: false)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <dl class="rdoc-list label-list"><dt>EXPERIMENTAL
<dd>
<p>Parses <code>src</code> and create S-exp tree. Returns more readable tree rather than <a href="Ripper.html#method-c-sexp_raw"><code>Ripper.sexp_raw</code></a>. This method is mainly for developer use. The <code>filename</code> argument is mostly ignored. By default, this method does not handle syntax errors in <code>src</code>, returning <code>nil</code> in such cases. Use the <code>raise_errors</code> keyword to raise a SyntaxError for an error in <code>src</code>.</p>

<pre>require &#39;ripper&#39;
require &#39;pp&#39;

pp Ripper.sexp(&quot;def m(a) nil end&quot;)
  #=&gt; [:program,
       [[:def,
        [:@ident, &quot;m&quot;, [1, 4]],
        [:paren, [:params, [[:@ident, &quot;a&quot;, [1, 6]]], nil, nil, nil, nil, nil, nil]],
        [:bodystmt, [[:var_ref, [:@kw, &quot;nil&quot;, [1, 9]]]], nil, nil, nil]]]]</pre>
</dd></dl>

                              <div class="method-source-code" id="sexp-source">
            <pre><span class="ruby-comment"># File ripper/lib/ripper/sexp.rb, line 35</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Ripper</span>.<span class="ruby-identifier ruby-title">sexp</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">filename</span> = <span class="ruby-string">&#39;-&#39;</span>, <span class="ruby-identifier">lineno</span> = <span class="ruby-value">1</span>, <span class="ruby-value">raise_errors:</span> <span class="ruby-keyword">false</span>)
  <span class="ruby-identifier">builder</span> = <span class="ruby-constant">SexpBuilderPP</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">filename</span>, <span class="ruby-identifier">lineno</span>)
  <span class="ruby-identifier">sexp</span> = <span class="ruby-identifier">builder</span>.<span class="ruby-identifier">parse</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">builder</span>.<span class="ruby-identifier">error?</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">raise_errors</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">SyntaxError</span>, <span class="ruby-identifier">builder</span>.<span class="ruby-identifier">error</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">sexp</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-sexp_raw" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">sexp_raw</span><span
                                class="method-args">(src, filename = &#39;-&#39;, lineno = 1, raise_errors: false)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <dl class="rdoc-list label-list"><dt>EXPERIMENTAL
<dd>
<p>Parses <code>src</code> and create S-exp tree. This method is mainly for developer use. The <code>filename</code> argument is mostly ignored. By default, this method does not handle syntax errors in <code>src</code>, returning <code>nil</code> in such cases. Use the <code>raise_errors</code> keyword to raise a SyntaxError for an error in <code>src</code>.</p>

<pre>require &#39;ripper&#39;
require &#39;pp&#39;

pp Ripper.sexp_raw(&quot;def m(a) nil end&quot;)
  #=&gt; [:program,
       [:stmts_add,
        [:stmts_new],
        [:def,
         [:@ident, &quot;m&quot;, [1, 4]],
         [:paren, [:params, [[:@ident, &quot;a&quot;, [1, 6]]], nil, nil, nil]],
         [:bodystmt,
          [:stmts_add, [:stmts_new], [:var_ref, [:@kw, &quot;nil&quot;, [1, 9]]]],
          nil,
          nil,
          nil]]]]</pre>
</dd></dl>

                              <div class="method-source-code" id="sexp_raw-source">
            <pre><span class="ruby-comment"># File ripper/lib/ripper/sexp.rb, line 71</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Ripper</span>.<span class="ruby-identifier ruby-title">sexp_raw</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">filename</span> = <span class="ruby-string">&#39;-&#39;</span>, <span class="ruby-identifier">lineno</span> = <span class="ruby-value">1</span>, <span class="ruby-value">raise_errors:</span> <span class="ruby-keyword">false</span>)
  <span class="ruby-identifier">builder</span> = <span class="ruby-constant">SexpBuilder</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">filename</span>, <span class="ruby-identifier">lineno</span>)
  <span class="ruby-identifier">sexp</span> = <span class="ruby-identifier">builder</span>.<span class="ruby-identifier">parse</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">builder</span>.<span class="ruby-identifier">error?</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">raise_errors</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">SyntaxError</span>, <span class="ruby-identifier">builder</span>.<span class="ruby-identifier">error</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">sexp</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-slice" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">slice</span><span
                                class="method-args">(src, pattern, n = 0)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <dl class="rdoc-list label-list"><dt>EXPERIMENTAL
<dd>
<p>Parses <code>src</code> and return a string which was matched to <code>pattern</code>. <code>pattern</code> should be described as Regexp.</p>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;ripper&#39;</span>

<span class="ruby-identifier">p</span> <span class="ruby-constant">Ripper</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-string">&#39;def m(a) nil end&#39;</span>, <span class="ruby-string">&#39;ident&#39;</span>)                   <span class="ruby-comment">#=&gt; &quot;m&quot;</span>
<span class="ruby-identifier">p</span> <span class="ruby-constant">Ripper</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-string">&#39;def m(a) nil end&#39;</span>, <span class="ruby-string">&#39;[ident lparen rparen]+&#39;</span>)  <span class="ruby-comment">#=&gt; &quot;m(a)&quot;</span>
<span class="ruby-identifier">p</span> <span class="ruby-constant">Ripper</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-string">&quot;&lt;&lt;EOS\nstring\nEOS&quot;</span>,
               <span class="ruby-string">&#39;heredoc_beg nl $(tstring_content*) heredoc_end&#39;</span>, <span class="ruby-value">1</span>)
    <span class="ruby-comment">#=&gt; &quot;string\n&quot;</span>
</pre>
</dd></dl>

                              <div class="method-source-code" id="slice-source">
            <pre><span class="ruby-comment"># File ripper/lib/ripper/lexer.rb, line 270</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Ripper</span>.<span class="ruby-identifier ruby-title">slice</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">pattern</span>, <span class="ruby-identifier">n</span> = <span class="ruby-value">0</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">m</span> = <span class="ruby-identifier">token_match</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">pattern</span>)
  <span class="ruby-keyword">then</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">string</span>(<span class="ruby-identifier">n</span>)
  <span class="ruby-keyword">else</span> <span class="ruby-keyword">nil</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-tokenize" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">tokenize</span><span
                                class="method-args">(src, filename = &#39;-&#39;, lineno = 1, **kw)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Tokenizes the Ruby program and returns an array of strings. The <code>filename</code> and <code>lineno</code> arguments are mostly ignored, since the return value is just the tokenized input. By default, this method does not handle syntax errors in <code>src</code>, use the <code>raise_errors</code> keyword to raise a SyntaxError for an error in <code>src</code>.</p>

<pre class="ruby"><span class="ruby-identifier">p</span> <span class="ruby-constant">Ripper</span>.<span class="ruby-identifier">tokenize</span>(<span class="ruby-string">&quot;def m(a) nil end&quot;</span>)
   <span class="ruby-comment"># =&gt; [&quot;def&quot;, &quot; &quot;, &quot;m&quot;, &quot;(&quot;, &quot;a&quot;, &quot;)&quot;, &quot; &quot;, &quot;nil&quot;, &quot; &quot;, &quot;end&quot;]</span>
</pre>

                              <div class="method-source-code" id="tokenize-source">
            <pre><span class="ruby-comment"># File ripper/lib/ripper/lexer.rb, line 25</span>
<span class="ruby-keyword">def</span> <span class="ruby-constant">Ripper</span>.<span class="ruby-identifier ruby-title">tokenize</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">filename</span> = <span class="ruby-string">&#39;-&#39;</span>, <span class="ruby-identifier">lineno</span> = <span class="ruby-value">1</span>, <span class="ruby-operator">**</span><span class="ruby-identifier">kw</span>)
  <span class="ruby-constant">Lexer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">filename</span>, <span class="ruby-identifier">lineno</span>).<span class="ruby-identifier">tokenize</span>(<span class="ruby-operator">**</span><span class="ruby-identifier">kw</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-column" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          column   &rarr; Integer
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Return column number of current parsing line. This number starts from 0.</p>

                              <div class="method-source-code" id="column-source">
            <pre>static VALUE
ripper_column(VALUE self)
{
    struct ripper *r;
    struct parser_params *p;
    long col;

    TypedData_Get_Struct(self, struct ripper, &amp;parser_data_type, r);
    p = r-&gt;p;
    if (!rb_ruby_ripper_initialized_p(p)) {
        rb_raise(rb_eArgError, &quot;method called for uninitialized object&quot;);
    }
    if (NIL_P(rb_ruby_parser_parsing_thread(p))) return Qnil;
    col = rb_ruby_ripper_column(p);
    return LONG2NUM(col);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-debug_output" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          debug_output   &rarr; obj
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Get debug output.</p>

                              <div class="method-source-code" id="debug_output-source">
            <pre>static VALUE
ripper_parser_get_debug_output(VALUE self)
{
    struct ripper *r;

    TypedData_Get_Struct(self, struct ripper, &amp;parser_data_type, r);
    return rb_ruby_parser_debug_output(r-&gt;p);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-debug_output-3D" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          debug_output = obj
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Set debug output.</p>

                              <div class="method-source-code" id="debug_output-3D-source">
            <pre>static VALUE
ripper_parser_set_debug_output(VALUE self, VALUE output)
{
    struct ripper *r;

    TypedData_Get_Struct(self, struct ripper, &amp;parser_data_type, r);
    rb_ruby_parser_set_debug_output(r-&gt;p, output);
    return output;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-encoding" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          encoding   &rarr; encoding
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Return encoding of the source.</p>

                              <div class="method-source-code" id="encoding-source">
            <pre>static VALUE
ripper_parser_encoding(VALUE vparser)
{
    struct ripper *r;

    TypedData_Get_Struct(vparser, struct ripper, &amp;parser_data_type, r);
    return rb_ruby_parser_encoding(r-&gt;p);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-end_seen-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          end_seen?   &rarr; Boolean
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Return true if parsed source ended by +_<em>END</em>_+.</p>

                              <div class="method-source-code" id="end_seen-3F-source">
            <pre>static VALUE
ripper_parser_end_seen_p(VALUE vparser)
{
    struct ripper *r;

    TypedData_Get_Struct(vparser, struct ripper, &amp;parser_data_type, r);
    return RBOOL(rb_ruby_parser_end_seen_p(r-&gt;p));
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-error-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          error?   &rarr; Boolean
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Return true if parsed source has errors.</p>

                              <div class="method-source-code" id="error-3F-source">
            <pre>static VALUE
ripper_error_p(VALUE vparser)
{
    struct ripper *r;

    TypedData_Get_Struct(vparser, struct ripper, &amp;parser_data_type, r);
    return RBOOL(rb_ruby_parser_error_p(r-&gt;p));
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-filename" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          filename   &rarr; String
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Return current parsing filename.</p>

                              <div class="method-source-code" id="filename-source">
            <pre>static VALUE
ripper_filename(VALUE self)
{
    struct ripper *r;
    struct parser_params *p;

    TypedData_Get_Struct(self, struct ripper, &amp;parser_data_type, r);
    p = r-&gt;p;
    if (!rb_ruby_ripper_initialized_p(p)) {
        rb_raise(rb_eArgError, &quot;method called for uninitialized object&quot;);
    }
    return rb_ruby_parser_ruby_sourcefile_string(p);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-lineno" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          lineno   &rarr; Integer
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Return line number of current parsing line. This number starts from 1.</p>

                              <div class="method-source-code" id="lineno-source">
            <pre>static VALUE
ripper_lineno(VALUE self)
{
    struct ripper *r;
    struct parser_params *p;

    TypedData_Get_Struct(self, struct ripper, &amp;parser_data_type, r);
    p = r-&gt;p;
    if (!rb_ruby_ripper_initialized_p(p)) {
        rb_raise(rb_eArgError, &quot;method called for uninitialized object&quot;);
    }
    if (NIL_P(rb_ruby_parser_parsing_thread(p))) return Qnil;
    return INT2NUM(rb_ruby_parser_ruby_sourceline(p));
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-parse" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          parse
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Start parsing and returns the value of the root action.</p>

                              <div class="method-source-code" id="parse-source">
            <pre>static VALUE
ripper_parse(VALUE self)
{
    struct ripper *r;
    struct parser_params *p;

    TypedData_Get_Struct(self, struct ripper, &amp;parser_data_type, r);
    p = r-&gt;p;
    if (!rb_ruby_ripper_initialized_p(p)) {
        rb_raise(rb_eArgError, &quot;method called for uninitialized object&quot;);
    }
    if (!NIL_P(rb_ruby_parser_parsing_thread(p))) {
        if (rb_ruby_parser_parsing_thread(p) == rb_thread_current())
            rb_raise(rb_eArgError, &quot;Ripper#parse is not reentrant&quot;);
        else
            rb_raise(rb_eArgError, &quot;Ripper#parse is not multithread-safe&quot;);
    }
    rb_ruby_parser_set_parsing_thread(p, rb_thread_current());
    rb_ensure(ripper_parse0, self, ripper_ensure, self);

    return rb_ruby_parser_result(p);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-state" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          state   &rarr; Integer
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Return scanner state of current token.</p>

                              <div class="method-source-code" id="state-source">
            <pre>static VALUE
ripper_state(VALUE self)
{
    struct ripper *r;
    struct parser_params *p;

    TypedData_Get_Struct(self, struct ripper, &amp;parser_data_type, r);
    p = r-&gt;p;
    if (!rb_ruby_ripper_initialized_p(p)) {
        rb_raise(rb_eArgError, &quot;method called for uninitialized object&quot;);
    }
    if (NIL_P(rb_ruby_parser_parsing_thread(p))) return Qnil;
    return INT2NUM(rb_ruby_parser_lex_state(p));
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-token" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          token   &rarr; String
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Return the current token string.</p>

                              <div class="method-source-code" id="token-source">
            <pre>static VALUE
ripper_token(VALUE self)
{
    struct ripper *r;
    struct parser_params *p;
    long pos, len;

    TypedData_Get_Struct(self, struct ripper, &amp;parser_data_type, r);
    p = r-&gt;p;
    if (!rb_ruby_ripper_initialized_p(p)) {
        rb_raise(rb_eArgError, &quot;method called for uninitialized object&quot;);
    }
    if (NIL_P(rb_ruby_parser_parsing_thread(p))) return Qnil;
    pos = rb_ruby_ripper_column(p);
    len = rb_ruby_ripper_token_len(p);
    return rb_str_subseq(rb_ruby_ripper_lex_lastline(p), pos, len);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-yydebug" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          yydebug   &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Get yydebug.</p>

                              <div class="method-source-code" id="yydebug-source">
            <pre>static VALUE
ripper_parser_get_yydebug(VALUE self)
{
    struct ripper *r;

    TypedData_Get_Struct(self, struct ripper, &amp;parser_data_type, r);
    return RBOOL(rb_ruby_parser_get_yydebug(r-&gt;p));
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-yydebug-3D" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          yydebug = flag
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Set yydebug.</p>

                              <div class="method-source-code" id="yydebug-3D-source">
            <pre>static VALUE
ripper_parser_set_yydebug(VALUE self, VALUE flag)
{
    struct ripper *r;

    TypedData_Get_Struct(self, struct ripper, &amp;parser_data_type, r);
    rb_ruby_parser_set_yydebug(r-&gt;p, RTEST(flag));
    return flag;
}</pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="private-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Private Instance Methods</h3>
                </header>

                  <div id="method-i-compile_error" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">compile_error</span><span
                                class="method-args">(msg)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>This method is called when the parser found syntax error.</p>

                              <div class="method-source-code" id="compile_error-source">
            <pre><span class="ruby-comment"># File ripper/lib/ripper/core.rb, line 63</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">compile_error</span>(<span class="ruby-identifier">msg</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-dedent_string" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">dedent_string</span><span
                                class="method-args">(p1, p2)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="dedent_string-source">
            <pre>static VALUE
parser_dedent_string(VALUE self, VALUE input, VALUE width)
{
    struct parser_params *p;
    rb_parser_config_t *config;
    struct dedent_string_arg args;

    config = rb_ruby_parser_config_new(ruby_xmalloc);
    rb_parser_config_initialize(config);
    p = rb_ruby_parser_new(config);

    args.p = p;
    args.input = input;
    args.width = width;
    return rb_ensure(parser_dedent_string0, (VALUE)&amp;args, parser_config_free, (VALUE)config);
}</pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: dedent_string
                            </div>

                          </div>

                  <div id="method-i-warn" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">warn</span><span
                                class="method-args">(fmt, *args)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>This method is called when weak warning is produced by the parser. <code>fmt</code> and <code>args</code> is printf style.</p>

                              <div class="method-source-code" id="warn-source">
            <pre><span class="ruby-comment"># File ripper/lib/ripper/core.rb, line 54</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">warn</span>(<span class="ruby-identifier">fmt</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-warning" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">warning</span><span
                                class="method-args">(fmt, *args)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>This method is called when strong warning is produced by the parser. <code>fmt</code> and <code>args</code> is printf style.</p>

                              <div class="method-source-code" id="warning-source">
            <pre><span class="ruby-comment"># File ripper/lib/ripper/core.rb, line 59</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">warning</span>(<span class="ruby-identifier">fmt</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>.</p><p><a href="https://jamesbritt.bandcamp.com/">Maximum R+D</a>.  </p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

